package com.edison.demo.until;

import java.util.Random;

/**
 * @author edison
 */
public class DocTypeGenerator {

    private DocTypeGenerator(){
        throw new IllegalStateException("Utility class");
    }

    private static final Random RANDOM = new Random();

    public static String generateDocType() {
        // Randomly decide the pattern: true for numeric, false for alpha-numeric
        boolean isNumericPattern = RANDOM.nextBoolean();

        if (isNumericPattern) {
            // Generate a 6-digit number, starting with 1, 6, or any other digit
            int firstDigit = RANDOM.nextBoolean() ? 6 : 1;
            // Generates a 5-digit number
            int remainingDigits = RANDOM.nextInt(100000);
            return String.format("%d%05d", firstDigit, remainingDigits);
        } else {
            // Generate an alpha-numeric pattern starting with a random letter followed by five zeros
            char letter = (char) ('A' + RANDOM.nextInt(26));
            return letter + "00000";
        }
    }


}
